# Contributor: omni <omni@gitlab.alpinelinux.org>
# Maintainer: omni <omni@gitlab.alpinelinux.org>
pkgname=dog
pkgver=0.1.0
pkgrel=0
pkgdesc="dog is a command-line DNS client"
url="https://github.com/ogham/dog"
arch="x86_64 armv7 armhf aarch64 ppc64le x86"
license="EUPL-1.2"
makedepends="cargo openssl-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ogham/dog/archive/v$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_LTO=true
export CARGO_PROFILE_RELEASE_PANIC="abort"
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm0755 target/release/$pkgname -t "$pkgdir"/usr/bin
	install -Dm0644 man/dog.1.md -t "$pkgdir"/usr/share/doc/"$pkgname"
	install -Dm0644 LICENCE -t "$pkgdir"/usr/share/licenses/"$pkgname"
}

sha512sums="
03af5414b995710d22ea19bdbf382def4e53ae2870f396b4103546743c9cafcc445ee0819b6c8b7f435793fead5ebd03f091be89293a32847868a5544b4bc0e5  dog-0.1.0.tar.gz
"
